<?php
/**
 *  Copyright (C) 2010  Alvaro Villalba <villalba.it@gmail.com>
 *  Url: http://code.google.com/p/form-element-multidate/
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

require_once 'Zend/View/Helper/FormElement.php';

/**
 * View_Helper_FormMultidate
 * 
 * Generates a set of select elements
 */
class View_Helper_FormMultidate extends Zend_View_Helper_FormElement
{
    /**
     * Input type to use
     * @var string
     */
    protected $_inputType = 'select';

    /**
     * Whether or not this element represents an array collection by default
     * @var bool
     */
    protected $_isArray = false;

    /**
     * Generates a set of select elements.
     *
     * @param string|array $name If a string, the element name.  If an
     * array, all other parameters are ignored, and the array elements
     * are extracted in place of added parameters.
     *
     * @param mixed $value.
     *
     * @param array $options An array of key-value pairs where the array
     * key is the checkbox value, and the array value is the radio text.
     *
     * @param array|string $attribs Attributes added to each radio.
     *
     * @return string The radio buttons XHTML.
     */
    public function formMultidate($name, $value = null, $attribs = null,
        $options = null, $listsep = "\n")
    {
		$xhtml = array();
		foreach( $options as $element ) {
			$xhtml[] = $element->render();
		}
		
		return implode($listsep, $xhtml);
    }
}
